package com.uzai.console.enums;

/**
 * 淘宝处罚订单处罚类型
 * @author liuqi
 * @date 2021/8/27 17:19
 * @param
 * @return null
 */
public enum TbPunishOrderViolationTypesEnum {

    DPTBK(1,"店铺淘宝客"),
    DDXJJY(2,"订单虚假交易"),
    ZHXJJY(3,"账户虚假交易"),
    DDBJYYC(4,"订单笔交易异常"),
    QT(5,"其他"),

    ;

    private Integer value;
    private String desc;

    TbPunishOrderViolationTypesEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static TbPunishOrderViolationTypesEnum getById(Integer id) {
        if (id == null) {
            return null;
        }
        for (TbPunishOrderViolationTypesEnum type: TbPunishOrderViolationTypesEnum.values()) {
            if (type.getValue().intValue() == id) {
                return type;
            }
        }
        return null;
    }

    public static TbPunishOrderViolationTypesEnum getByDesc(String desc) {
        if (desc == null) {
            return null;
        }
        for (TbPunishOrderViolationTypesEnum type: TbPunishOrderViolationTypesEnum.values()) {
            if (type.getDesc().equals(desc)) {
                return type;
            }
        }
        return null;
    }
}
